import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App'
import goods from './components/goods/goods'
import Axios from './common/http'
import i18n from './common/i18n'
import './common/stylus/index.styl'
import {Lazyload} from 'mint-ui'
import 'mint-ui/lib/style.css'


import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant)

import 'swiper/css/swiper.css'
import VueAwesomeSwiper from 'vue-awesome-swiper'
function getUrlKey (name) {
  return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
}

Vue.use(VueAwesomeSwiper)

Vue.use(VueRouter)
Vue.use(Lazyload)
Vue.config.productionTip = false
Vue.prototype.$REQ_URL = 'http://order.huaqiaobang.com/index.php?' // 接口请求地址

let shopId = getUrlKey("shopId");
let table = getUrlKey("table");


if (!shopId) {
  shopId = getUrlKey("shopid");
}

if (!shopId) {
  shopId = 341;
}
if (!table) {
  table = 1;
}



Vue.prototype.$SHOP_ID = shopId// 店铺id
Vue.prototype.$TABLE = table// 店铺id
// 341
// 330 
Vue.prototype.$http = Axios

// 定义路由
const routes = [
  { path: '/', redirect: '/goods' },
  { path: '/goods', component: goods }
]

// 创建router实例
const router = new VueRouter({
  routes,
  linkActiveClass: 'active'
})

// 创建和挂载根实例
new Vue({
  router,
  i18n,
  el: '#app',
  render: (h) => h(App)
})
